import { _decorator, Component, Node } from 'cc';
import { GameManager, GameState } from '../GameManager';
const { ccclass, property } = _decorator;

@ccclass('Bullet_1')
export class Bullet_1 extends Component {

    @property
    bullet_1_Speed:number=600;

    start() {

    }

    update(deltaTime: number) {
        if (GameManager.getInstance().gameState == GameState.START){
                
            const newPos=this.node.getPosition();
    
            newPos.y+=this.bullet_1_Speed*deltaTime
            this.node.setPosition(newPos);
    
            if(newPos.y<=-1000){
                this.node.destroy();
            }
        }
        
    }
}


